%{
#include <string.h>
#include "tokens.h"

int charPos = 1;
int yywrap(void){
    charPos = 1;
    return 1;
}

void broadcast(){
    tokPos = charPos;
    charPos += yyleng;
}
%}

%%
" "  {broadcast(); continue;}
\n   {broadcast(); printf("new line\n"); continue;}
","  {broadcast(); return COMMA;}
for      {broadcast(); return FOR;}
[0-9]+   {broadcast(); yylval.ival=atoi(yytext); return INT;}
.    {broadcast(); printf("illegal token\n");}
